
/* This is a small dot product and cross product library to calculate the 
   normals. All pointers are assumed to have three float allocated for the
   x, y, and the z.
   The last point is assumed to be the empty buffer to load the values into.
*/

#include <math.h>

#include "point.h"

#ifndef _NORMAL_H_
#define _NORMAL_H_

	/* A quick utility function that changes points to vectors so
	   that it can be used in the cross product. */
void VectorOffset (Point& pIn, Point& pOffset, Point& pOut);

	/* Does the calculation of the normal through the cross product
	   formula. This is not normalized. */
void VectorGetNormal (Point& a, Point& b, Point& pOut);

	/* Normalizes a vector. */
int VectorNormalize (Point& pIn, Point& pOut);

	/* A high level function that generates a normal for three points
	   that form a plane. */
void CalcNormal (Point& normal, Point& p1, Point& p2, Point& p3);

	/* The result of the dot product of two points */
float DotProd (Point& p1, Point& p2);

	/* Get the length of the line that joins the two points. */
float len (Point& point1, Point& point2);

#endif
